<?php


namespace Part19_CombinationMode\Code2;

require_once '../../autoload.php';

$root = new ConcreteCompany('北京总公司');
$root->add(new HRDepartment('北京总公司','人力资源部'));
$root->add(new FinanceDepartment('北京总公司','财务部'));

$comp = new ConcreteCompany('上海华东分公司');
$comp->add(new HRDepartment('上海华东分公司','人力资源部'));
$comp->add(new FinanceDepartment('上海华东分公司','财务部'));
$root->add($comp);

$comp1 = new ConcreteCompany('南京办事处');
$comp1->add(new HRDepartment('南京办事处','人力资源部'));
$comp1->add(new FinanceDepartment('南京办事处','财务部'));
$comp->add($comp1);

$comp2 = new ConcreteCompany('杭州办事处');
$comp2->add(new HRDepartment('杭州办事处','人力资源部'));
$comp2->add(new FinanceDepartment('杭州办事处','财务部'));
$comp->add($comp2);

echo "结构图\n\n\n";
$root->display(1);

echo "\n\n职责\n\n\n";
$root->lineOfDuty();
